Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-10365] Drop OrganizationUser AccessAll #4701

Merged

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Aug 27, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-10365

📔 Objective

Final step in removing OrganizationUser.AccessAll column:

  • MSSQL: (1) add a default column value, (2) update sprocs to remove the column, (3) drop the column
    • also drop some old sprocs no longer in use and the TVP they used
  • EF: remove shadow property configuration and run migrations

WARNING: this includes an index rebuild on the OrganizationUsers table, because the index previously included the AccessAll column. I have dropped & recreated it without this column on the assumption it's still useful for the remaining columns in the index. However we may need to coordinate this index rebuild with BRE.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.78%. Comparing base (02fee8c) to head (576be63).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4701      +/-   ##
==========================================
- Coverage   41.78%   41.78%   -0.01%     
==========================================
  Files        1308     1308              
  Lines       62131    62128       -3     
  Branches     5725     5725              
==========================================
- Hits        25964    25961       -3     
  Misses      34972    34972              
  Partials     1195     1195              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Aug 27, 2024

Logo
Checkmarx One – Scan Summary & Details057bd9d2-a9e8-407d-ba08-ea2cee4445c7

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Missing_CSP_Header /src/Core/MailTemplates/Handlebars/TrialInitiation.html.hbs: 47 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/SecretsManager/Controllers/ProjectsController.cs: 112
MEDIUM CSRF /src/Api/SecretsManager/Controllers/ProjectsController.cs: 51
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 128
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 119
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 99
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 61
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 218
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 361
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 361
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 107
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 80
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 346
MEDIUM CSRF /src/Admin/AdminConsole/Controllers/OrganizationsController.cs: 355
MEDIUM CSRF /src/Api/AdminConsole/Controllers/OrganizationUsersController.cs: 100
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 128
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 119
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 99
MEDIUM CSRF /src/Api/AdminConsole/Controllers/GroupsController.cs: 92
MEDIUM CSRF /src/Api/SecretsManager/Controllers/ProjectsController.cs: 51
MEDIUM CSRF /src/Api/SecretsManager/Controllers/ProjectsController.cs: 112
MEDIUM CSRF /src/Api/Controllers/CollectionsController.cs: 61

Base automatically changed from ac/pm-10368/remove-group-accessall-from-sprocs-and-table to main September 2, 2024 05:01
@eliykat eliykat force-pushed the ac/pm-10365/remove-organizationuser-accessall-from-sprocs-and-table branch from f73c672 to 94a400a Compare September 2, 2024 21:38
Comment on lines 35 to 38
-- Recreate the index without the column
PRINT N'Recreating index IX_OrganizationUser_UserIdOrganizationIdStatus...';
CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatus]
ON [dbo].[OrganizationUser]([UserId] ASC, [OrganizationId] ASC, [Status] ASC);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the index rebuild

Comment on lines 5 to 6
IF OBJECT_ID('[dbo].[DF_OrganizationUser_AccessAll]', 'D') IS NULL
AND COL_LENGTH('[dbo].[OrganizationUser]', 'AccessAll') IS NOT NULL
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkac-bw the equivalent migraiton for Groups didn't check for the existence of the column (only for the non-existence of the constraint), so it throws an error if run multiple times. Theoretically dbup shouldn't run a migration multiple times, but it is something we try to support. Do you want me to go back and fix that?

Compare: https://github.com/bitwarden/server/blob/main/util/Migrator/DbScripts/2024-09-02_00_DropGroupAccessAll_DefaultColumnValue.sql#L5

@eliykat eliykat marked this pull request as ready for review September 2, 2024 21:53
@eliykat eliykat requested a review from a team as a code owner September 2, 2024 21:53
@eliykat eliykat force-pushed the ac/pm-10365/remove-organizationuser-accessall-from-sprocs-and-table branch from c9850da to 93bbc0b Compare September 13, 2024 04:59
rkac-bw
rkac-bw previously approved these changes Sep 24, 2024
Copy link
Contributor

@rkac-bw rkac-bw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@rkac-bw rkac-bw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eliykat eliykat merged commit f7bc5df into main Sep 24, 2024
37 of 38 checks passed
@eliykat eliykat deleted the ac/pm-10365/remove-organizationuser-accessall-from-sprocs-and-table branch September 24, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants